<%--
  Created by IntelliJ IDEA.
  User: 花花
  Date: 2021/6/27
  Time: 23:00
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path=request.getContextPath();
%>
<html>
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
</head>
<body style="text-align: center;background-image: url(index.jpg);background-repeat: no-repeat">
<div id="bigbox" style="margin: 0 auto;margin-top: 250px;
padding: 20px 50px;background-color: #00000090;
width: 400px;height: 300px;border-radius: 10px;text-align: center;">
    <h1 style="color: white">修改密码</h1>
    <form action="<%=path%>/reset" method="post" id="resetForm" style="margin-top: 30px;">
        <input style="margin-top: 20px;border: 0;padding: 10px 10px;border-bottom:1px solid white;background-color:#00000000;color:white;"
               placeholder="您的用户名" type="text" name="uname" id="uname" value="${messageModel.object.userName}"><br>
        <input style="margin-top: 20px;border: 0;padding: 10px 10px;border-bottom:1px solid white;background-color:#00000000;color:white;"
               placeholder="新密码" type="password" name="upwd" id="upwd"><br>
        <span id="resetmsg" style="font-size: 12px;color: red">${messageModel.msg}</span><br>
        <input style="border:0;width:75px;height:25px;color:white;border-radius: 20px;
        background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%);"
               type="submit" id="resetBtn" value="立即修改">
    </form>
</div>
</body>
<script type="text/javascript" src="js/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
    $("#resetBtn").click(function (){
        var uname = $("#uname").val();
        var upwd = $("#upwd").val();
    if(isEmpty(uname)){
        $("#resetmsg").html("用户姓名不可为空！");
        return;
    }
    if(isEmpty(upwd)){
        $("#resetmsg").html("用户密码不可为空！");
        return;
    }
    $("#resetForm").submit();
    });
    function isEmpty(str){
        if(str==null || str.trim()==""){
            return true;
        }
        return false;
    }
</script>
</html>
